package com.projet.livre;

import java.util.HashMap;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.projet.MainActivity;
import com.projet.R;
import com.projet.carte.Carte;

public class Livre extends Activity {

	MainActivity mainActivity = null;
	public static HashMap<String, Integer> pages = new HashMap<String, Integer>(); 
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_livre);
		
		Typeface font = Typeface.createFromAsset(getAssets(), "Klaudia.ttf");
		TextView tv=(TextView) findViewById(R.id.textView1);
		tv.setTypeface(font);
		tv=(TextView) findViewById(R.id.textView1);
		tv.setTypeface(font);
		tv=(TextView) findViewById(R.id.textView1);
		tv.setTypeface(font);

	}
	
	/** Called when the user clicks the Send button */
	public void page1(View view) {
	    // Do something in response to button
		Intent intent = new Intent(this, Page.class);		
		intent.putExtra(Page.NUM_PAGE, "0");

		startActivity(intent);
		
		//Set the transition -> method available from Android 2.0 and beyond  
		overridePendingTransition(R.anim.push_left_in, 0); 
	}
	
	/**
	 * Ouvrir la carte
	 * @param view
	 */
	public void openMap (View view) {
		Intent intent = new Intent(this, Carte.class);
		//MainActivity.openedPage = -1;
		startActivity(intent);
	}
	
	public static void openMap (Context context) {
		Intent intent = new Intent(context, Carte.class);
		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		context.startActivity(intent);
	}
	
	/**
	 * Ouvre la page i
	 * @param pageNumber
	 */
	public static void openPage(Context context, int pageNumber) {
	    // Do something in response to button
		Intent intent = new Intent(context, Page.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		intent.putExtra(Page.NUM_PAGE, ""+(pageNumber-1));

		context.startActivity(intent);
		
		//Set the transition -> method available from Android 2.0 and beyond  
		//context.overridePendingTransition(R.anim.push_left_in, 0); 
	}
	
	

}
